package com.learn.mvc.controller;

import com.learn.mvc.vo.LearnInfo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
public class HelloController {
    @Value("${server.port}")
    private String port;

    @Value("${learn.info}")
    private String info;

    @Resource
    private LearnInfo learnInfo;

    @PostMapping("hello")
    @ResponseBody
    public String sayHello(@RequestBody String jsonString){
        System.out.println(jsonString);
        return  "hello spring: 好的： " + port + info;
    }

    @GetMapping("learn")
    @ResponseBody
    public String queryInfo(){
        return  "learnInfo: " + learnInfo.toString();
    }
}
